package fit.conceptmap.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the concept database table.
 * 
 */
@Entity
@NamedQuery(name="Concept.findAll", query="SELECT c FROM Concept c")
public class Concept implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String idConcept;

	private String docLink;

	private String name;

	//bi-directional many-to-one association to Node
	@OneToMany(mappedBy="concept")
	private List<Node> nodes;

	//bi-directional many-to-one association to Relationship
	@OneToMany(mappedBy="conceptFrom")
	private List<Relationship> relationships1;

	//bi-directional many-to-one association to Relationship
	@OneToMany(mappedBy="conceptTo")
	private List<Relationship> relationships2;

	public Concept() {
	}

	public String getIdConcept() {
		return this.idConcept;
	}

	public void setIdConcept(String idConcept) {
		this.idConcept = idConcept;
	}

	public String getDocLink() {
		return this.docLink;
	}

	public void setDocLink(String docLink) {
		this.docLink = docLink;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Node> getNodes() {
		return this.nodes;
	}

	public void setNodes(List<Node> nodes) {
		this.nodes = nodes;
	}

	public Node addNode(Node node) {
		getNodes().add(node);
		node.setConcept(this);

		return node;
	}

	public Node removeNode(Node node) {
		getNodes().remove(node);
		node.setConcept(null);

		return node;
	}

	public List<Relationship> getRelationships1() {
		return this.relationships1;
	}

	public void setRelationships1(List<Relationship> relationships1) {
		this.relationships1 = relationships1;
	}

	public Relationship addRelationships1(Relationship relationships1) {
		getRelationships1().add(relationships1);
		relationships1.setConceptFrom(this);

		return relationships1;
	}

	public Relationship removeRelationships1(Relationship relationships1) {
		getRelationships1().remove(relationships1);
		relationships1.setConceptFrom(null);

		return relationships1;
	}

	public List<Relationship> getRelationships2() {
		return this.relationships2;
	}

	public void setRelationships2(List<Relationship> relationships2) {
		this.relationships2 = relationships2;
	}

	public Relationship addRelationships2(Relationship relationships2) {
		getRelationships2().add(relationships2);
		relationships2.setConceptTo(this);

		return relationships2;
	}

	public Relationship removeRelationships2(Relationship relationships2) {
		getRelationships2().remove(relationships2);
		relationships2.setConceptTo(null);

		return relationships2;
	}

}